<?php
/***************************************************************
*  Copyright notice
*  (c) 2008, jianyuzhu@gmail.com
*  All rights reserved
*  This script is part of the PPEMI project.
***************************************************************/

//
if( file_exists('stop.php') ) {
	include_once('stop.php');
}

//
set_time_limit(0);

//
require(dirname(dirname(__FILE__)) . '/includes/application_top.php');

//
include_once(CONFIG_PATH . CONFIG_DIR_INCLUDES . 'functions/thumb.function.php');
include_once(CONFIG_PATH . CONFIG_DIR_CLASSES . 'core.directory.class.php');
include_once(CONFIG_PATH . CONFIG_DIR_CLASSES . 'core.upload.class.php');
include_once(CONFIG_PATH . CONFIG_DIR_CLASSES . 'core.file.class.php');
include_once(CONFIG_PATH . CONFIG_DIR_FUNCTIONS . 'thumb.function.php');

//
$dir = 'outings/';

//
$dObj = new CoreDirectoryParser(CONFIG_PATH . CONFIG_DIR_UPLOADS_ORIGINS . $dir);
$dObj->parse();
$_dir = $dObj->_dir;
$files = $dObj->getFiles();
//
if( is_array($files) ) {
	foreach($files as $key => $file) {
		//
		$from_file = CONFIG_PATH . CONFIG_DIR_UPLOADS_ORIGINS . 'italytour2007/' . $file['file'];
		$to_file = CONFIG_PATH . CONFIG_DIR_UPLOADS_ORIGINS . $dir . $file['file'];
		//
		unlink($to_file);
		//
		copy($from_file, $to_file);
	}
}//
//
echo 'OK';
//
?>